<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var dict_data = {
            name:'安娜',
            age:20,
            my_func:function(){
                console.log('你好');
            },
            gender:'女'
        }

        console.log(dict_data.name);
        console.log(dict_data.age);
        console.log(dict_data.gender);
        dict_data.my_func();


        // 通过object创建对象
        var my_obj = new Object();
        my_obj.name = '双双';
        my_obj.age = 10;
        my_obj.my_func = function(){
            console.log('世界');
        }

        console.log(my_obj.name);
        my_obj.my_func();

        // 使用构造函数创建对象
        function Animal(name,age){
            this.name = name;
            this.age = age;

            this.run = function(){
                console.log(this.name + '正在跑...')
            }
        }

        var hashiqi = new Animal('小强',4);
        hashiqi.run()
    </script>
</head>
<body>
    
</body>
</html>